<template>
  <div class="recommendBox" :style="outModuleCss">
    <div :style="moduleBgCss" class="module-bg"></div>
    <div class="recommendContent">
      <div class="title" v-if="propsData.params.useTitle == 1">
        {{ propsData.params.text }}
      </div>
      <div class="toolsList" :style="{
        paddingBottom:propsData.params.showStyle == 1? '10px':''
      }">
        <template v-if="propsData.params.showStyle == 1">
          <div class="toolItem" v-for="(item,index) in propsData.params.list" :key="index" @click.stop="chooseItem(item)">
            <img src="@/assets/images/diy/default_img.png" alt="" v-if="!item.iconUrl || item.iconUrl == ''"/>
            <img :src="item.iconUrl" alt="" v-else>
            <span :style="item.css">{{item.name}}</span>
          </div>
        </template>
        <template v-if="propsData.params.showStyle == 2">
          <div class="toolItem1" v-for="(item,index) in propsData.params.list" :key="index" @click.stop="chooseItem(item)">
            <img src="@/assets/images/diy/default_img.png" alt="" v-if="!item.iconUrl || item.iconUrl == ''"/>
            <img :src="item.iconUrl" alt="" v-else>
            <span :style="item.css">{{item.name}}</span>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import { mixinsModuleCss } from "@/components/DiyNew/diy/mixins/index.js";
export default {
  name: "userTools",
  props: {
    propsData: {
      type: Object,
      default: {},
    },
  },
  mixins: [mixinsModuleCss],
  components: {},
  data() {
    return {};
  },
  methods:{
      chooseItem(e) {
          console.log(e);
          this.$emit('chooseMoudle',e)
      }
  }
};
</script>

<style lang="scss" scoped>
.recommendBox {
  width: 100%;
  position: relative;
  .module-bg {
    width: 100%;
    height: 100%;
    z-index: -1;
    position: absolute;
    left: 0;
    top: 0;
  }
  .recommendContent {
    width: 100%;
    padding: 0 12px;
    .title {
      padding: 10px 0;
      font-size: 14px;
      font-family: PingFang SC;
      color: #262626;
      font-weight: 600;
      border-bottom: 1px solid #f1f1f1;
    }
    .toolsList {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      .toolItem {
        width: 20%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 10px;
        position: relative;
        img {
          width: 25px;
          height: 25px;
        }
        span {
          font-size: 12px;
          color: #242427;
          margin-top: 7px;
        }
      }
      .toolItem:hover::before {
        cursor: pointer;
        content: "\e657";
        font-family: "iconfont";
        position: absolute;
        right: 0;
        top: 0;
        width: 20px;
        height: 20px;
        background-color: #1890fc;
        border-radius: 0 0 0 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #fff;
      }
      .toolItem:hover::after {
        cursor: pointer;
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        border: 1px solid #1890fc;
      }
      .toolItem1 {
        width: 100%;
        display: flex;
        align-items: center;
        position: relative;
        img {
          width: 16px;
          min-width: 16px;
          height: 16px;
          margin-right: 12px;
        }
        span {
          flex: auto;
          padding: 15px 0;
          border-bottom: 1px solid #f1f1f1;
        }
      }
      .toolItem1:last-child {
        span {
          border-bottom: none;
        }
      }
      .toolItem1:hover::before {
        cursor: pointer;
        content: "\e657";
        font-family: "iconfont";
        position: absolute;
        right: 0;
        top: 0;
        width: 20px;
        height: 20px;
        background-color: #1890fc;
        border-radius: 0 0 0 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #fff;
      }
      .toolItem1:hover::after {
        cursor: pointer;
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        border: 1px solid #1890fc;
      }
    }
  }
}
</style>